Fix libfsimage build on NetBSD.
authorKeir Fraser <keir@xensource.com>
Sun, 23 Sep 2007 11:18:36 +0000 (12:18 +0100)
committerKeir Fraser <keir@xensource.com>
Sun, 23 Sep 2007 11:18:36 +0000 (12:18 +0100)
Fixes a number of these errors:
 cc1: warnings being treated as errors
 fsys_fat.c: In function 'fat_dir':
 fsys_fat.c:304: warning: array subscript has type 'char'

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
These ugly casts are needed according to the ISO C spec.

Acked-by: Keir Fraser <keir@xensource.com>
tools/libfsimage/ext2fs/fsys_ext2fs.c
tools/libfsimage/fat/fsys_fat.c
tools/libfsimage/iso9660/fsys_iso9660.c
tools/libfsimage/reiserfs/fsys_reiserfs.c
tools/libfsimage/ufs/fsys_ufs.c

index 7a25c550222de5e84dacf52898162eb3c6545c23..366c4aa76dafbae30c15141112a70be535e5e9d4 100644 (file)
@@ -594,7 +594,7 @@ ext2fs_dir (fsi_file_t *ffi, char *dirname)
 
          /* Find out how long our remaining name is. */
          len = 0;
-         while (dirname[len] && !isspace (dirname[len]))
+         while (dirname[len] && !isspace ((uint8_t)dirname[len]))
            len++;
 
          /* Get the symlink size. */
@@ -651,7 +651,7 @@ ext2fs_dir (fsi_file_t *ffi, char *dirname)
        }
 
       /* if end of filename, INODE points to the file's inode */
-      if (!*dirname || isspace (*dirname))
+      if (!*dirname || isspace ((uint8_t)*dirname))
        {
          if (!S_ISREG (INODE->i_mode))
            {
@@ -678,7 +678,7 @@ ext2fs_dir (fsi_file_t *ffi, char *dirname)
        }
 
       /* skip to next slash or end of filename (space) */
-      for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/';
+      for (rest = dirname; (ch = *rest) && !isspace ((uint8_t)ch) && ch != '/';
           rest++);
 
       /* look through this directory and find the next filename component */
index a0afb87f49fffe0001800d6adc95e186f81fe0fe..819465a16b06b8b53501976b24f505014f9215f9 100644 (file)
@@ -301,7 +301,7 @@ fat_dir (fsi_file_t *ffi, char *dirname)
   /* if we have a real file (and we're not just printing possibilities),
      then this is where we want to exit */
   
-  if (!*dirname || isspace (*dirname))
+  if (!*dirname || isspace ((uint8_t)*dirname))
     {
       if (attrib & FAT_ATTRIB_DIR)
        {
@@ -325,7 +325,7 @@ fat_dir (fsi_file_t *ffi, char *dirname)
   /* Directories don't have a file size */
   filemax = INT_MAX;
   
-  for (rest = dirname; (ch = *rest) && !isspace (ch) && ch != '/'; rest++);
+  for (rest = dirname; (ch = *rest) && !isspace ((uint8_t)ch) && ch != '/'; rest++);
   
   *rest = 0;
   
@@ -426,13 +426,13 @@ fat_dir (fsi_file_t *ffi, char *dirname)
       {
        int i, j, c;
        
-       for (i = 0; i < 8 && (c = filename[i] = tolower (dir_buf[i]))
-              && !isspace (c); i++);
+       for (i = 0; i < 8 && (c = filename[i] = tolower ((uint8_t)dir_buf[i]))
+              && !isspace ((uint8_t)c); i++);
        
        filename[i++] = '.';
        
-       for (j = 0; j < 3 && (c = filename[i + j] = tolower (dir_buf[8 + j]))
-              && !isspace (c); j++);
+       for (j = 0; j < 3 && (c = filename[i + j] = tolower ((uint8_t)dir_buf[8 + j]))
+              && !isspace ((uint8_t)c); j++);
        
        if (j == 0)
          i--;
index 31a317a6377ddb6592242b2dc20d181b6e78ca27..20254ba4f50f9dc07450b35be8538e1e9eb1fd3d 100644 (file)
@@ -164,7 +164,7 @@ iso9660_dir (fsi_file_t *ffi, char *dirname)
       /* pathlen = strcspn(dirname, "/\n\t "); */
       for (pathlen = 0 ;
           dirname[pathlen]
-            && !isspace(dirname[pathlen]) && dirname[pathlen] != '/' ;
+            && !isspace((uint8_t)dirname[pathlen]) && dirname[pathlen] != '/' ;
           pathlen++)
        ;
 
index 6bf6067ded84a52df5dbf2a9777bf694f22490ab..9ec173bf6d20774d593480823086af3968b4e535 100644 (file)
@@ -1029,7 +1029,7 @@ reiserfs_dir (fsi_file_t *ffi, char *dirname)
 
          /* Find out how long our remaining name is. */
          len = 0;
-         while (dirname[len] && !isspace (dirname[len]))
+         while (dirname[len] && !isspace ((uint8_t)dirname[len]))
            len++;
 
          if (filemax + len > sizeof (linkbuf) - 1)
@@ -1078,7 +1078,7 @@ reiserfs_dir (fsi_file_t *ffi, char *dirname)
       /* if we have a real file (and we're not just printing possibilities),
         then this is where we want to exit */
       
-      if (! *dirname || isspace (*dirname))
+      if (! *dirname || isspace ((uint8_t)*dirname))
        {
          if (! S_ISREG (mode))
            {
@@ -1109,7 +1109,7 @@ reiserfs_dir (fsi_file_t *ffi, char *dirname)
          errnum = ERR_BAD_FILETYPE;
          return 0;
        }
-      for (rest = dirname; (ch = *rest) && ! isspace (ch) && ch != '/'; rest++);
+      for (rest = dirname; (ch = *rest) && ! isspace ((uint8_t)ch) && ch != '/'; rest++);
       *rest = 0;
       
 # ifndef STAGE1_5
index d187dbf41447d250c3546abbb32274be17e7394a..a92a6e5307d35218cec44eed901aa0c0b6f7db63 100644 (file)
@@ -72,13 +72,13 @@ ufs_dir(fsi_file_t *ffi, char *dirname)
        while (*dirname == '/')
                dirname++;
 
-       while (inode && *dirname && !isspace(*dirname)) {
+       while (inode && *dirname && !isspace((uint8_t)*dirname)) {
                if (!openi(ffi, inode))
                        return 0;
 
                /* parse for next path component */
                fname = dirname;
-               while (*dirname && !isspace(*dirname) && *dirname != '/')
+               while (*dirname && !isspace((uint8_t)*dirname) && *dirname != '/')
                        dirname++;
                ch = *dirname;
                *dirname = 0;   /* ensure null termination */